<template>
  <div class="upload-container">
    <h1>大文件分片上传系统</h1>
    
    <!-- 简化的上传组件，使用内部默认参数 -->
    <FileUploader
      @upload-success="handleUploadSuccess"
      @upload-error="handleUploadError"
    />
  </div>
</template>

<script>
import FileUploader from './components/FileUploader.vue';

export default {
  name: 'App',
  components: {
    FileUploader
  },
  methods: {
    handleUploadSuccess(result) {
      console.log('文件上传成功:', result);
      this.$message.success({
        title: '上传成功',
        message: `文件 ${result.fileName} 上传成功！文件哈希值：${result.fileHash}`,
        duration: 5000
      });
    },
    handleUploadError(error) {
      console.error('文件上传失败:', error);
      this.$message.error({
        title: '上传失败',
        message: error.message || '文件上传过程中发生错误',
        duration: 5000
      });
    }
  }
};
</script>

<style>
.upload-container {
  width: 800px;
  margin: 0 auto;
  padding: 20px;
}
</style>